package main

import (
	"fmt"
	"gorm.io/driver/mysql"
	"gorm.io/gorm"
	"morleyStoneHome/dao"
)

func main() {
	conf := &gorm.Config{}
	dsn := "root:8888@tcp(127.0.0.1:3306)/ninja_dev?charset=utf8mb4&parseTime=True&loc=Local" //conf.MySqlUrl
	dao.Db, _ = gorm.Open(mysql.Open(dsn), conf)

	list, _ := dao.StoWithdrawDao.FindFreezeList()
	for i := 0; i < len(list); i++ {
		withdraw := list[i]
		fmt.Println(withdraw)
	}
	//tx, _ := dao.ChainDao.GetTx("0x0000000000000000000000000000000000000001", 6000000)
	//fmt.Println(tx)
	//stos, _ := dao.StoRewardDao.FindOne(3)
	//sto:= stos[0]
	//data := make(map[string]interface{})
	//data["balance"] = 0 //零值字段
	//data["freeze"] = sto.Balance
	//dao.StoRewardDao.UpdateByMap(sto.Uid,data)

	//var t = &model.StoSreward{
	//	time.Now(),
	//	123456.01,
	//}
	//dao.ChainDao.InsertSreward(t)

	//dao.ChainDao.InsertSreward(&model.StoSreward{
	//	time.Now(),
	//	10086.01,
	//})
	//var t =time.Date(time.Now())
	//release := dao.ChainDao.FindRelease()
	//pd := release[0].ReleasePd
	//fmt.Println(pd)

	//sreward := dao.ChainDao.GetSreward(time.Now())
	//fmt.Println(sreward[0].Sreward)
	//fmt.Println(sreward[0].Ctime)

	//list := dao.ChainDao.FindPoolList()
	//for i := 0; i < len(list); i++ {
	//	fmt.Println(list[i])
	//}

	//list, _ := dao.PledgeDao.FindOne("0xb8da6c79aa9fe6a8caf62b2e8cd1705d9da5c51a")
	//now :=time.Now()
	//sub := now.Sub(list[0].LedgerTime)
	//
	//fmt.Println(">>>>>>>>>>>>>>",sub.Hours())
	//hours := sub.Hours()
	//var res =hours/24
	//floor:= math.Floor(res)
	//fmt.Println(">>>>>>>>>>>>>>",floor)

	//var cat  =&model.Catcoin{
	//	5,
	//	"0x0000000000555",
	//	800,
	//	200866,
	//	10,
	//	400,
	//	2,
	//	"3,6",
	//	time.Now(),
	//	time.Now(),
	//}
	//dao.CatcoinDao.Update("0x0000000000000",cat)
	//dao.CatcoinDao.Insert(cat)

	//one, _ := dao.WalletDeviceUidDao.FindOne("0x9219e411D5D106f9deC642a60AfF8B7b2368c1d9")
	//fmt.Println(one)
	//list, err := dao.CatcoinDao.FindAllMarketerList()
	//if err != nil {
	//
	//}
	//fmt.Println(list)
	//err := dao.StoRewardDao.UpdateLife()
	//if nil != err {
	//	log.Panicf(err.Error())
	//}
	//var reward float64
	//reward = 200.00
	//res := util.FloatToBigInt(reward)
	//fmt.Println(res)
	//
	//byAddr, err := dao.StoRewardDao.FindOneByAddr("551")
	//if nil != err {
	//	logrus.Error(err)
	//}
	//sto := &byAddr[0]
	//sto.Freeze = sto.Balance
	//sto.Balance = 0
	//fmt.Println(sto)
	//var m = &model.Catcoin{
	//	9,
	//	"abc",
	//	10086,
	//	5,
	//	2,
	//	"3",
	//	time.Now(),
	//	time.Now(),
	//}
	//dao.CatcoinDao.Insert(m)
	//dao.CatcoinDao.Insert(&model.Catcoin{
	//	6,
	//	"0x9F7288d3abC1bd4d82A3809BFEe98a8B0F1d08f4",
	//	1008699,
	//	0,
	//	1,
	//	"0,1,",
	//	time.Now(),
	//	time.Now(),
	//})
	//one, _ := dao.CatcoinDao.FindOneByInv(871384)
	//one2, _ := dao.CatcoinDao.FindOne("0x180F98E9ca42f0fB71bBe8fC8fC202c140F26F73")
	//findOne, _ := dao.WalletDeviceUidDao.FindOne("0x180F98E9ca42f0fB71bBe8fC8fC202c140F26F73")
	//fmt.Println(one)
	//fmt.Println(one2)
	//fmt.Println(findOne)

}
